{extend name="base/main" /}
{block name="body"}
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>系统配置</legend>
</fieldset>
<form class="layui-form" action="{:url('Other/update')}" style="margin-left: 50px">
    <div class="layui-form-item">
        <label class="layui-form-label">赠送礼物广告图：</label>
        <div class="col-sm-4">
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="test1">上传图片</button>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" id="demo1" width="70px" height="70px">
                    <input type="hidden" name="img" id="img">
                    <p id="demoText1"></p>
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-4">
            <label class="layui-form-label" style="width: 100px">虚拟用户专题弹幕开关</label>
            <div class="radio i-checks" style="height: 60px;">
                <label class=""><input type="radio" value="0" name="status" checked><i></i>开启</label>
                <label class=""><input type="radio" value="1" name="status"><i></i>关闭</label>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">专题弹幕停留时间</label>
        <div class="layui-input-inline">
            <input type="text" name="time" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">首页图标：</label>
        <div class="col-sm-4">
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="test2">上传图片</button>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" id="demo2" width="70px" height="70px">
                    <input type="hidden" name="img" id="image">
                    <p id="demoText2"></p>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">单次签到虚拟币数</label>
        <div class="layui-input-inline">
            <input type="text" name="count" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">签到海报：</label>
        <div class="col-sm-4">
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="test3">上传图片</button>
                <div class="layui-upload-list">
                    <img class="layui-upload-img" id="demo3" width="70px" height="70px">
                    <input type="hidden" name="img" id="logo">
                    <p id="demoText3"></p>
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-4">
            <label class="layui-form-label">余额开关</label>
            <div class="radio i-checks" style="height: 60px;">
                <label class=""><input type="radio" value="0" name="is_status"><i></i>开启</label>
                <label class=""><input type="radio" value="1" name="is_status" checked><i></i>关闭</label>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="hidden" name="id" value="">
            <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
        </div>
    </div>
</form>
<script>
    layui.use(['upload', 'element', 'layer'], function(){
        var $ = layui.jquery
            ,upload = layui.upload
            ,element = layui.element
            ,layer = layui.layer;
        //常规使用 - 普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            ,url: "{:url('other/upload')}" //改成您自己的上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
                if(res.code == 0){
                    $('#img').val(res.data);
                    return layer.msg('上传成功');
                }
                //上传成功的一些操作
                //……
                $('#demoText1').html(''); //置空上传失败的状态
            }
        });
    });
    layui.use(['upload', 'element', 'layer'], function() {
        var $ = layui.jquery
            , upload = layui.upload
            , element = layui.element
            , layer = layui.layer;
        var uploadInst = upload.render({
            elem: '#test2'
            , url: "{:url('other/upload')}" //改成您自己的上传接口
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo2').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                if (res.code == 0) {
                    $('#image').val(res.data);
                    return layer.msg('上传成功');
                }
                //上传成功的一些操作
                //……
                $('#demoText2').html(''); //置空上传失败的状态
            }
        });
    });
        layui.use(['upload', 'element', 'layer'], function () {
            var $ = layui.jquery
                , upload = layui.upload
                , element = layui.element
                , layer = layui.layer;
            upload.render({
                elem: '#test3'
                , url: "{:url('other/upload')}" //改成您自己的上传接口
                , before: function (obj) {
                    //预读本地文件示例，不支持ie8
                    obj.preview(function (index, file, result) {
                        $('#demo3').attr('src', result); //图片链接（base64）
                    });
                }
                , done: function (res) {
                    //如果上传失败
                    if (res.code > 0) {
                        return layer.msg('上传失败');
                    }
                    if (res.code == 0) {
                        $('#logo').val(res.data);
                        return layer.msg('上传成功');
                    }
                    //上传成功的一些操作
                    //……
                    $('#demoText3').html(''); //置空上传失败的状态
                }
            });
        })
</script>
{/block}